package com.hotel.api.service.impl;

import com.hotel.api.entity.Post;
import com.hotel.api.entity.PostLike;
import com.hotel.api.mapper.PostLikeMapper;
import com.hotel.api.mapper.PostMapper;
import com.hotel.api.service.PostService;
import com.hotel.api.vo.UserPostVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 帖子管理
 *
 * @Author 涛涛
 * @Create 2019/8/29
 */
@Service
public class PostServiceImpl implements PostService {

    @Autowired
    private PostMapper postMapper;

    @Autowired
    private PostLikeMapper postLikeMapper;

    @Override
    public int insert(Post post) {
        return postMapper.insert(post);
    }

    @Override
    public List<Post> selectAll() {
        return postMapper.selectAll();
    }

    @Override
    public int deletePostById(Integer id) {
        return postMapper.deletePostById(id);
    }

    @Override
    public List<UserPostVO> userScanPost(Integer uid) {
        return postMapper.userScanPost(uid);
    }

    @Override
    public List<Post> selectUserPost(Integer id) {
        return postMapper.selectUserPost(id);
    }

    @Override
    public int insert(PostLike postLike) {
        return postLikeMapper.insert(postLike);
    }

    @Override
    public int userCancelLike(Integer uid, Integer pid) {
        return postLikeMapper.userCancelLike(uid, pid);
    }


}
